<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/blogs/comments" title="blogs">Comments</a></li>

    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="div_header"><?php __('Comments'); ?></div>
    <div class="div_content">
        <div class="paging">
            <?php //echo $this->element('admin/cmspages/top_menu'); ?>
	</div>
           <table id="category_table" cellspacing="0" class="tablesorter">
            <thead>
                <tr>
                    <th width="50" ><?php echo _('id'); ?></th>
                    <th width="120" ><?php echo _('Comment'); ?></th>
                    <th width="70" align="center">Actions</th>

                </tr>
            </thead>
            <tbody>
                <?php
                $i = 0;
                //pr($blogs);
               foreach ($comments as $comment):
                    $class = null;
                    if ($i++ % 2 == 0) :
                        $class = ' class="alt"';
                ?>
                        <tr>
                            <td class="alt"> <?php echo $i; ?></td>
                            <td class="alt">
                           <?php echo $comment['BlogComment']['comment']; ?>
                            </td>
                    <td align="center" class="alt">
                    <?php
                if($comment['BlogComment']['publish']==1){
                ?>
                <div id="status<?php echo $comment['BlogComment']['id']; ?>">
                <label>
                <input type="checkbox" checked="checked" name="isactive" onclick="return inactive('<?php echo $comment['BlogComment']['id']; ?>')"></label><div  style="display: inline;">active</div></div>
                <?php
                }else{
                ?>
                <div id="status<?php echo $comment['BlogComment']['id']; ?>">
                <label>
                <input type="checkbox" name="isactive" onclick="return active('<?php echo $comment['BlogComment']['id']; ?>')"></label><div style="display: inline;">inactive</div></div>
                <?php
                }
                ?>
                     </td>
                </tr>
				<?php else: ?>
                <tr>
                    <td> <?php echo $i; ?></td>
                            <td>
                            <?php echo $comment['BlogComment']['comment']; ?>
                            </td>
                    <td align="center">
                       <?php
                if($comment['BlogComment']['publish']==1){
                ?>
                <div id="status<?php echo $comment['BlogComment']['id']; ?>">
                <label>
                <input type="checkbox" checked="checked" name="isactive" onclick="return inactive('<?php echo $comment['BlogComment']['id']; ?>')"></label><div  style="display: inline;">active</div></div>
                <?php
                }else{
                ?>
                <div id="status<?php echo $comment['BlogComment']['id']; ?>">
                <label>
                <input type="checkbox" name="isactive" onclick="return active('<?php echo $comment['BlogComment']['id']; ?>')"></label><div style="display: inline;">inactive</div></div>
                <?php
                }
                ?>
                    </td>

                </tr>
				<?php endif;endforeach;?>
                    <tbody>
                </table>
 <div class="paging">

		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	  	<?php echo $this->Paginator->numbers();?>

		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
            </div>
    
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->
<!--        </div>-->

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js")); ?>
<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery("#category_table").tablesorter({headers: {2:{sorter: false}}});
    });
</script>
 <script type="text/javascript">
function active(id)
{
			jQuery.ajax({

				url : "<?php echo Configure::read('base_url');?>blogs/active/"+id,

				success : function (html) {
					//jQuery("#html_textarea").hide();
					document.getElementById("status"+id).innerHTML = "";
					jQuery("#status"+id).append(html);
				}
		   	});
}
</script>
<script type="text/javascript">
function inactive(id)
{
			//alert('sdfsdf');
                        //die();
                        jQuery.ajax({

				url : "<?php echo Configure::read('base_url');?>blogs/inactive/"+id,

				success : function (html) {
					//jQuery("#html_textarea").hide();
					document.getElementById("status"+id).innerHTML = "";
					jQuery("#status"+id).append(html);
				}
		   	});
}
</script>